<%@ page import="java.util.ArrayList" %>
<%@ page import="com.ba360.portal.database.dbo.SearchAgent" %>

<%@ taglib uri="/WEB-INF/displaytag-12.tld" prefix="display" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
	<%
		com.ba360.portal.database.dbo.User user = (com.ba360.portal.database.dbo.User)session.getAttribute("USER");
		if (user==null)
		{
			request.setAttribute("USER_NOT_LOGGED_IN","UNPLUGGED");
	%>

			<jsp:forward page="/portal/login.do"/>
	
	     <% } %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>droik.com</title>
<link href="../css/sample1.css" rel="stylesheet" type="text/css">
<style type="text/css">
	<!--
	body {
		background-image: url(../images/main_bg2.gif);
	}
	.style2 {color: #88DB23}
	.style3 {color: #FFFFFF}
	-->
</style>
</head>
<script language="javascript">
var selectedrow;
function modify(id) {

	selectedrow = id;
	var url = "../portal/ModifySearchAgent.do?action=EDIT_AGENT&selectedrow=" + selectedrow;
	window.location.href = url;
}
function deleteAgent(id) {
	selectedrow = id;
	var url = "../portal/DeleteSearchAgent.do?action=EDIT_AGENT&selectedrow=" + selectedrow;
	window.location.href = url;
}
</script>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<jsp:include page="top.jsp"/>
<br>
<table width="720" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><img src="../images/classifieds_n_tab.gif" width="720" height="76" border="0" usemap="#Map" href="../portal/index.do"></td>
  </tr>
  <tr>
    <td background="../images/border_bg2.gif">
      <table width="680" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td colspan="5">
              <table border="0" cellpadding="3" cellspacing="1" width="100%" class="text">
                <tr>
                	<td>
						<table width=100%>
							<%
								ArrayList searchAgents = null;
								if (session.getAttribute("SEARCHAGENTS") != null) {
										searchAgents = (ArrayList) session.getAttribute("SEARCHAGENTS");
								}
								if(searchAgents==null || searchAgents.size()==0) {
							%>
								<tr>
									<td class="title">There is no search agent created by you.</td>
							<%
								} else {
							%>
									<tr>
									<th scope="row"><p class="req">Keywords</p></th>
									<th scope="row"><p class="req">Matchtype</p></th>
									<th scope="row"><p class="req">Created date</p></th>
									<th scope="row"><p class="req">Timeframe</p></th>
									</tr>
							<%
									for(int i=0; i<searchAgents.size(); i++) {
										SearchAgent agent = (SearchAgent) searchAgents.get(i);
							%>
											<tr>
												<td align="center"><%=agent.getKeywords()%></td>
												<%
													if(agent.getMatchtype() == 1) {
												%>
														<td align="center">All of my keywords</td>
												<%
													} else {
												%>
														<td align="center">Any of my keywords</td>
												<%
													}
												%>
												<td align="center"><%=agent.getCreateddate()%></td>
												<td align="center"><%=agent.getTimeframe()%></td>
												<td align="center"><input type="button" name="Back" value="Modify" onClick="javascript:modify(<%=i%>)"/></td>
												<td align="center"><input type="button" name="Back" value="Delete" onClick="javascript:deleteAgent(<%=i%>)"/></td>
											</tr>
									<%
										}
								}
							%>
						</table>
				<tr>
					<td align="center"><input type="button" class="button" name="Back" value="Back" onClick="javascript:history.back()"/></td>
				</tr>
              	</table>
		  </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td><img src="../images/border_bot2.gif" width="719" height="20"></td>
  </tr>
</table>
 <br>
 <br>
<jsp:include page="../jsp/footer.html"/>
<jsp:include page="map.html"/>
</body>
</html>
